<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- 绑定img url属性 -->
        <h1>{{message}}</h1>
        <div>
            <button @click="changeimg">切换图片</button>
        </div>
        <img v-bind:src="imgurl" alt="">
        <a v-bind:href="href">超链接</a>
        
        <!-- 语法糖："v-bind:"简写 ":" -->
    </div>
    <script src="https://unpkg.com/vue@next"></script>
    <script>
        //用vue创建app
        const app = Vue.createApp({
            data: function () {
                return {
                    message: "Hello word",
                    imgurl: "http://p3.music.126.net/i12pbDR7xexdUnLSFBBhRQ==/109951168012472581.jpg",
                    imgurl01: "http://p3.music.126.net/i12pbDR7xexdUnLSFBBhRQ==/109951168012472581.jpg",
                    imgurl02: " http://p3.music.126.net/jpGpwxor2KCsMsqFhROGNA==/109951168164727442.jpg?",
                    href: "http://www.baidu.com"
                }
            },
            methods: {
                changeimg: function () {
                    this.imgurl = this.imgurl === this.imgurl01 ? this.imgurl02 : this.imgurl01
                }
            }
        })
        //挂载app
        app.mount("#app")
    </script>

</body>

</html>